package com.example.demo.controller;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 */
public class Test {
    public Test() {

    }

    private int i = 0;
    public int j = 0;
    //NG
    public final static String CON = "常量";

    public int getI() {
        String sex = "";
//        if ("1".equals(sex)){//NG
//    }
        if (Constanse.SEX_M.equals(sex)) {

        } else {

        }
        return i;
    }

    public String getStr() {
        //方法一
        String str = "123";
        //NG
        str += "456";
        //NG

        //
        StringBuilder sb = new StringBuilder(256);
        //对系统内存消耗比较省
        sb.append("123");
        sb.append("456");
        //对一个sb对象进行操作 返回一个对象
        return sb.toString();
    }

    public List<String> getList() {
        return new ArrayList<>();
    }

    public void setList(List<String> list) {

    }

    public String getStr2() {
        return null;
    }
}
